home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Atari Mega Archive 1
/
Atari Mega Archive - Volume 1.iso
/
games
/
pinfo.zoo
/
pinfo_ti.txt
< prev
next >
Wrap
Text File
|
1992-12-01
|
33KB
|
859 lines
PINFO_TI(3) Contributed Software PINFO_TI(3)
NAME
pinfo_ti - Description of the terminal interface to the portable
Infocom datafile interpreter.
SYNOPSIS
#include <stdio.h>
#include "infocom.h"
extern gflags_t gflags;
extern char *ti_location;
extern char *ti_status;
const char *scr_usage;
const char *scr_long_usage;
const char *scr_opt_list;
int scr_cmdarg( int argc, char ***argv_p );
int scr_getopt( int c, const char *arg );
void scr_setup( int margin,
int indent,
int lines,
int context );
void scr_begin();
void scr_putline( const char *buffer );
void scr_putscore();
void scr_putsound( int number,
int action,
int volume,
int argc );
void scr_putmesg( const char *buffer, Bool is_error );
int scr_getline( const char *prompt,
int length,
char *buffer );
void scr_window( int size );
void scr_set_win( int win );
FILE *scr_open_sf( int length, char *buffer, int type );
void scr_close_sf( const char *buffer, FILE *fp, int is_save );
void scr_end();
void scr_shutdown();
Revision 3.0 21 October 1992 1
PINFO_TI(3) Contributed Software PINFO_TI(3)
DESCRIPTION
These routines form the interface between the portable Infocom
datafile interpreter (pinfocom) and a particular type of terminal.
The pinfocom package comes with interfaces to the following terminal
types:
termcap
This terminal type supports all(?) UNIX systems via an inter-
face to either termcap or terminfo terminal capability and
either termio, termios, or sgtty line discipline control.
Optional support for the GNU readline line editing and his-
tory library is also available.
amiga This terminal type supports an Amiga interface, including
sound and command line editing. See amiga.c for full
details.
msdos This terminal type supports MS-DOS based systems. See
msdos.c for full details.
stream This terminal type should support any system with a C com-
piler; it uses simple C stdio routines that all C libraries
will have. Nothing fancy, but it works.
Also in the works is an X11-based interface.
This man page describes the interface between the pinfo interpreter
and the terminal support packages so that programmers can create
their own interfaces to new systems. Terminal interface will be
abbreviated to TI below.
Environment
The interpreter operates in two modes: game-playing mode (default)
and information mode (if any of the command-line options -h, -o, -O,
-v and/or -V are given), where the game is not played but informa-
tion about it is instead displayed on the screen.
All input and output in game-playing mode is done via the scr_*()
functions described below. Output during information mode is via
simple C stdio library functions.
The only interface between the interpreter and the terminal handling
code is through the functions and global variables described below;
no other symbols in the TI code should be externally visible and any
other external symbols in the interpreter code are subject to
change.
GENERAL
Some general issues to be considered:
Asynchronous Events
The interpreter registers a signal handler for the SIGINT signal and
sets to ignore the SIGQUIT signal (if defined).
Revision 3.0 21 October 1992 2
PINFO_TI(3) Contributed Software PINFO_TI(3)
Any other signals or other asynchronous events are free to be han-
dled by the TI as it sees fit. Note, however, that none of these
handler routines may modify or access any interpreter variables:
interpreter variables listed below are only guaranteed to be valid
when one of the scr_*() functions below has been properly called
from within the interpreter code.
Proportional Fonts
If the TI supports multiple fonts it is perfectly reasonable to use
proportional-width fonts for printing general game text if you wish.
However, at certain points in the game fixed-width fonts are
required, such as when printing maps, etc. To accomodate this,
before printing to the screen scr_putline() (see below) should
invoke the macro F2_IS_SET(B_FIXED_FONT). If this macro returns
non-0 then the current buffer should be printed in a fixed-width
font; if it returns 0 then a proportional-width font may be used if
desired.
Scripting
All Infocom games support the script command, which is supposed to
begin a transcript of the user's adventure. Normally this initial-
ized the printer and all subsequent text and commands were printed
to the printer as well as to the screen.
The TI may support this feature as well. There's no Z-Code primi-
tive for turning on and off scripting, however: instead a flag is
set or reset. In scr_putline() and scr_getline() the macro call
F2_IS_SET(B_SCRIPTING) should be used; if it returns non-0 then the
output line or prompt and command should be printed to the script
file as well as the display.
The interface will call scr_open_sf() with a file type of SF_SCRIPT
when a script file is to be opened and scr_close_sf() when a script
file is to be closed.
Fixed Window
Only Seastalker makes use of the fixed window feature in Standard
Series games, but it's nice to have nevertheless.
If the TI can support a fixed window in addition to the normal
scrolling text window then scr_begin() should notify the interpreter
by calling F1_SETB(B_STATUS_WIN). In this case the scr_window() and
scr_set_win() functions described below will be used to cre-
ate/manage/delete the fixed window.
If the TI cannot support a fixed window then the above macro should
not be called and scr_window() and scr_set_win() may be dummy func-
tions.
GLOBAL VARIABLES
These global variables are defined in the interpreter code and may
be used by the TI:
Revision 3.0 21 October 1992 3
PINFO_TI(3) Contributed Software PINFO_TI(3)
gflags
Contains global flags and other general variables of interest. The
only field which may be modified is the pr_status field, if the TI
doesn't support status line printing.
ti_location
This nul-terminated string is a short description of the current
location of the player, for printing on the status line. It is usu-
ally displayed on the left-hand side of the status line.
ti_status
This nul-terminated string contains the status of the player.
Depending on the game this may be score, score and turn number, or
the current time in a 12-hour clock. This string is usually printed
on the right-hand side of the status line.
These global variables should be defined in the TI .c file; they
will be declared exter